package com.xbongbong.saas.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * SAAS特殊列表
 *
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/2/16 20:52
 * @since v1.0
 */
@Getter
public enum SaasSpecialListEnum {
    //客户列表字段有区分
    CUSTOMER(XbbRefTypeEnum.CUSTOMER.getCode(),XbbRefTypeEnum.CUSTOMER.getAlias()),
    CUSTOMER_FOCUS(XbbRefTypeEnum.CUSTOMER_FOCUS.getCode(),XbbRefTypeEnum.CUSTOMER_FOCUS.getAlias()),
    CUSTOMER_DEAL(XbbRefTypeEnum.CUSTOMER_DEAL.getCode(),XbbRefTypeEnum.CUSTOMER_DEAL.getAlias()),
    CUSTOMER_FOLLOW(XbbRefTypeEnum.CUSTOMER_FOLLOW.getCode(),XbbRefTypeEnum.CUSTOMER_FOLLOW.getAlias()),
    CUSTOMER_PUBLIC(XbbRefTypeEnum.CUSTOMER_PUBLIC.getCode(),XbbRefTypeEnum.CUSTOMER_PUBLIC.getAlias()),
    CUSTOMER_RECYCLE(XbbRefTypeEnum.CUSTOMER_RECYCLE.getCode(),XbbRefTypeEnum.CUSTOMER_RECYCLE.getAlias()),
    // SAAS特殊列表
    WAITINSTOCK(XbbRefTypeEnum.WAIT_INSTOCK_PURCHASE.getCode(),XbbRefTypeEnum.WAIT_INSTOCK_PURCHASE.getAlias()),
    WAITOUTSTOCK(XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),XbbRefTypeEnum.WAIT_OUTSTOCK.getAlias()),
    WAITPURCHASE(XbbRefTypeEnum.WAIT_PURCHASE.getCode(),XbbRefTypeEnum.WAIT_PURCHASE.getAlias()),
    WAITPRODUCE(XbbRefTypeEnum.WAIT_PRODUCE.getCode(),XbbRefTypeEnum.WAIT_PRODUCE.getAlias()),
    SMART_REPLENISHMENT(XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),XbbRefTypeEnum.SMART_REPLENISHMENT.getAlias()),
    //工单
    WORKORDER(XbbRefTypeEnum.WORK_ORDER.getCode(),XbbRefTypeEnum.WORK_ORDER.getAlias()),
    WORK_ORDER_ROB(XbbRefTypeEnum.WORK_ORDER_ROB.getCode(),XbbRefTypeEnum.WORK_ORDER_ROB.getAlias()),

    //库存
    STOCK_SEARCH(XbbRefTypeEnum.STOCK_SEARCH.getCode(),XbbRefTypeEnum.STOCK_SEARCH.getAlias()),
    WARNING_SEARCH(XbbRefTypeEnum.WARNING_SEARCH.getCode(),XbbRefTypeEnum.WARNING_SEARCH.getAlias()),
    GUARANTEE_SEARCH(XbbRefTypeEnum.GUARANTEE_SEARCH.getCode(),XbbRefTypeEnum.GUARANTEE_SEARCH.getAlias()),

    //线索列表字段有区分
    ALL_CLUE(XbbRefTypeEnum.ALL_CLUE.getCode(),XbbRefTypeEnum.ALL_CLUE.getAlias()),
    CLUE_PUBLIC(XbbRefTypeEnum.CLUE_PUBLIC.getCode(),XbbRefTypeEnum.CLUE_PUBLIC.getAlias()),
    CLUE_RECYCLE(XbbRefTypeEnum.CLUE_RECYCLE.getCode(),XbbRefTypeEnum.CLUE_RECYCLE.getAlias()),

    //知识库
    KNOWLEDGE_BASE(XbbRefTypeEnum.KNOWLEDGE_BASE.getCode(),XbbRefTypeEnum.KNOWLEDGE_BASE.getAlias()),

    UNKNOW(404,"unknow")
    ;

    private Integer code;
    private String alias;

    SaasSpecialListEnum(Integer code, String alias) {
        this.code = code;
        this.alias = alias;
    }

    public static SaasSpecialListEnum getByBusinessType(Integer businessType){
        for (SaasSpecialListEnum saasSpecialListEnum : values()){
            if (Objects.equals(saasSpecialListEnum.code,businessType)){
                return saasSpecialListEnum;
            }
        }
        return UNKNOW;
    }
}
